CLIENTS += xenstore-write
CLIENTS_OBJS := $(patsubst xenstore-%,xenstore_%.o,$(CLIENTS))
-all: libxenstore.so xenstored $(CLIENTS) xs_tdb_dump
+all: libxenstore.so xenstored $(CLIENTS) xs_tdb_dump xsls
testcode: xs_test xenstored_test xs_random
$(CLIENTS_OBJS): xenstore_%.o: xenstore_client.c
$(COMPILE.c) -DCLIENT_$(*F) -o $@ $<
+xsls: xsls.o
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -L. -lxenstore -o $@
+
xenstored_test: xenstored_core_test.o xenstored_watch_test.o xenstored_domain_test.o xenstored_transaction_test.o xs_lib.o talloc_test.o fake_libxc.o utils.o tdb.o
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
$(INSTALL_DIR) -p $(DESTDIR)/usr/include
$(INSTALL_PROG) xenstored $(DESTDIR)/usr/sbin
$(INSTALL_PROG) $(CLIENTS) $(DESTDIR)/usr/bin
+ $(INSTALL_PROG) xsls $(DESTDIR)/usr/bin
$(INSTALL_DIR) -p $(DESTDIR)/usr/$(LIBDIR)
$(INSTALL_DATA) libxenstore.so $(DESTDIR)/usr/$(LIBDIR)
$(INSTALL_DATA) xs.h $(DESTDIR)/usr/include
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <err.h>
+#include <xs.h>
+
+void print_dir(struct xs_handle *h, char *path, int cur_depth)
+{
+ char **e;
+ char newpath[512], *val;
+ int num, i, len;
+
+ e = xs_directory(h, NULL, path, &num);
+ if (e == NULL)
+ err(1, "xs_directory (%s)", path);
+
+ for (i = 0; i<num; i++) {
+ int j;
+ for (j=0; j<cur_depth; j++) printf(" ");
+ printf("%s", e[i]);
+ sprintf(newpath, "%s%s%s", path,
+ path[strlen(path)-1] == '/' ? "" : "/",
+ e[i]);
+ val = xs_read(h, NULL, newpath, &len);
+ if (val == NULL)
+ printf(":\n");
+ else if ((unsigned)len > (151 - strlen(e[i])))
+ printf(" = \"%.*s...\"\n", 148 - strlen(e[i]), val);
+ else
+ printf(" = \"%s\"\n", val);
+ free(val);
+ print_dir(h, newpath, cur_depth+1);
+ }
+ free(e);
+}
+
+int main(int argc, char *argv[])
+{
+ struct xs_handle *xsh = xs_daemon_open();
+
+ if (xsh == NULL)
+ err(1, "xs_daemon_open");
+
+ print_dir(xsh, argc == 1 ? "/" : argv[1], 0);
+
+ return 0;
+}